package com.test.dataSource.config;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;

public enum DataSourceName {
    D0("d0","0","第0个"),
    D1("d1","1","第1个");
    private String key;
    private String value;
    private String desc;
    static final Map<String, String> cityKeyAnValueMap = new HashMap();

    DataSourceName(String key, String value, String desc) {
        this.key = key;
        this.value = value;
        this.desc = desc;
    }

    public String key() {
        return this.key;
    }

    public String value() {
        return this.value;
    }

    public String desc() {
        return this.desc;
    }

    public static String queryValueByKey(String key) {
        return (String)cityKeyAnValueMap.get(key);
    }

    public static String queryKeyByValue(String value) {
        Iterator var1 = cityKeyAnValueMap.entrySet().iterator();

        Map.Entry entry;
        do {
            if (!var1.hasNext()) {
                return null;
            }

            entry = (Map.Entry)var1.next();
        } while(!Objects.equals(entry.getValue(), value));

        return (String)entry.getKey();
    }

    static {
        DataSourceName[] dataSourceNames = values();
        DataSourceName[] var1 = dataSourceNames;
        int var2 = dataSourceNames.length;

        for(int var3 = 0; var3 < var2; ++var3) {
            DataSourceName ds = var1[var3];
            cityKeyAnValueMap.put(ds.key(), ds.value());
        }

    }
}